using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Windows.SyncManager.Interop;

namespace iPodShuffle
{
//	[ComVisible(true)]
//	[Guid("B7E9CB72-BA0E-4529-A5BF-CED8B410899B")]
	public class FileSyncMgrEnumItems: ISyncMgrEnumItems
	{
		public FileSyncMgrEnumItems( SYNCMGRITEM[] items )
		{
			Items = items;
		}

		protected SYNCMGRITEM[] Items;
		protected int Index;

		#region ISyncMgrEnumItems Members

		public int Next(
			  int count
			, SYNCMGRITEM[] items
			, out int fetched)
		{
			fetched = 0;

			for ( ;Index < Items.Length && fetched < count
				  ;Index ++, fetched ++ )
			{
				items[fetched] = Items[Index];
			}

			const int S_FALSE = 1;
			const int S_OK    = 0;

			return 0 < fetched? S_OK: S_FALSE;
		}

		public void Skip(int count)
		{
			Index += count;
		}

		public void Reset()
		{
			Index = 0;
		}

		public void Clone(out ISyncMgrEnumItems ppEnum)
		{
			ppEnum = null;
			throw new NotImplementedException();
		}

		#endregion
	}
}
